<template>
  <div class="bond">
    <!-- 缴纳修改弹窗 -->
    <el-dialog
      title="修改缴纳记录"
      width="640px"
      :visible.sync="payFormVisible"
      :close-on-click-modal="false"
      @close="closeFormDialog()"
      custom-class="dialog-minwidth"
      :modal-append-to-body="false"
    >
      <el-form
        :model="formData"
        label-width="135px"
        :rules="formRules"
        ref="formData"
        class="payFormXg"
      >
        <el-form-item label="项目名称：">
          <span>{{ formData.projectName || '--' }}</span>
        </el-form-item>
        <el-form-item label="保证金缴纳方式：" prop="method">
          <el-radio-group
            v-if="isHsUser()"
            :disabled="true"
            v-model="formData.method"
            @change="payTypeChange"
          >
            <el-radio label="FUNDDEPOSIT">资金存入</el-radio>
            <el-radio label="BANKGUARANTEE">银行保函</el-radio>
            <el-radio label="BANKPOLICY">保险保单</el-radio>
          </el-radio-group>
          <el-radio-group
            v-else
            :disabled="true"
            v-model="formData.method"
            @change="payTypeChange"
          >
            <el-radio label="FUNDDEPOSIT">资金存入</el-radio>
            <el-radio label="BANKGUARANTEE">银行保函</el-radio>
            <el-radio label="OWNERPOLICY">{{
              isXiangYangUser() ? '工程担保公司保函' : '业主担保'
            }}</el-radio>
            <el-radio label="BANKPOLICY">保险保单</el-radio>
          </el-radio-group>
        </el-form-item>
        <!-- 选择资金存入才显示缴纳形式 -->
        <el-form-item
          label="缴纳形式："
          prop="payMethod"
          v-if="formData.method === 'FUNDDEPOSIT'"
        >
          <el-radio-group
            :disabled="true"
            v-model="formData.payMethod"
            @change="payTypeChange"
          >
            <el-radio label="ALL_PAY">全额缴纳</el-radio>
            <el-radio label="PART_PAY">部分免缴</el-radio>
            <el-radio label="ALL_NO_PAY">全额免缴</el-radio>
            <el-radio label="WAIT_PAY">缓缴</el-radio>
          </el-radio-group>
        </el-form-item>
        <!-- 昆明增加收缴单位 -->
        <el-form-item
          class="radioTipsBox"
          label="收缴单位："
          prop="collectionUnit"
          v-if="isKMUser()"
        >
          <el-select
            v-model="formData.collectionUnit"
            clearable
            filterable
            placeholder="请选择"
          >
            <el-option
              v-for="(item, index) in collectionUnitList"
              :key="index"
              :label="item.name"
              :value="item.code"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="缴纳单位：" prop="reciveunit">
          <el-radio-group v-model="formData.reciveunit">
            <el-radio
              v-for="(item, index) in companyOptions"
              :key="index"
              :label="item.companyType"
              >{{ item.companyName }}({{
                item.companyType === '0' ? '建设方' : '施工方'
              }})</el-radio
            >
          </el-radio-group>
        </el-form-item>
        <template
          v-if="
            formData.method === 'FUNDDEPOSIT' &&
            formData.payMethod === 'WAIT_PAY'
          "
        >
          <el-form-item label="缓缴周期：">
            <el-date-picker
              type="daterange"
              placeholder="请选择保证金缓缴日期"
              range-separator="至"
              v-model="operationDate"
              value-format="yyyy-MM-dd"
            ></el-date-picker>
          </el-form-item>
        </template>
        <template v-else>
          <el-form-item label="缴纳日期：" prop="operationDate">
            <el-date-picker
              class="mWidth"
              type="date"
              placeholder="请选择保证金缴纳日期"
              v-model="formData.operationDate"
              value-format="yyyy-MM-dd"
            ></el-date-picker>
          </el-form-item>
        </template>
        <!-- 资金存入-（全额缴纳/部分免缴）存在缴纳银行和缴纳账号信息 -->
        <el-form-item
          label="缴纳银行："
          prop="bankOne"
          v-if="
            formData.method === 'FUNDDEPOSIT' &&
            (formData.payMethod === 'ALL_PAY' ||
              formData.payMethod === 'PART_PAY')
          "
        >
          <el-radio-group
            :disabled="isDisabled"
            v-model="formData.bankOne"
            @change="changeBankName"
          >
            <el-radio
              v-for="(item, index) in bankNameList"
              :key="index"
              :label="item.bankId + ',' + item.account + ',' + item.bankName"
              >{{ item.bankName }}</el-radio
            >
          </el-radio-group>
          <span style="color: red" v-if="noBank">
            <i class="icon iconfont iconshengming"></i>
            该项目所在的区域暂未设置缴纳银行</span
          >
        </el-form-item>
        <el-form-item
          label="缴纳账号："
          prop="depositAccountId"
          v-if="
            formData.method === 'FUNDDEPOSIT' &&
            (formData.payMethod === 'ALL_PAY' ||
              formData.payMethod === 'PART_PAY')
          "
        >
          <span style="color: #606266">{{ formData.account }}</span>
        </el-form-item>
        <el-form-item label="应缴金额：" prop="shouldPay">
          <el-radio-group v-model="formDataShouldPay" @change="agreeChange()">
            <el-radio
              v-if="item.depositConfig"
              :label="item.shouldPay + '-' + item.depositConfig.scale"
              :key="index + '0'"
              v-for="(item, index) in amountPayableList"
            >
              <span v-if="item.sectionType == 1"
                >{{ item.shouldPay }}元 【
                <span
                  v-for="(items, indexs) in item.depositConfigs"
                  :key="indexs"
                >
                  <span v-if="indexs == 0"
                    >{{ items.max * 10000 }}*{{ items.scale }}%
                    <span v-if="indexs < item.depositConfigs.length - 1"
                      >+</span
                    ></span
                  >
                  <span v-else>
                    <span v-if="item.total&lt;items.max*10000"
                      >({{ item.total }}-{{
                        item.depositConfigs[indexs - 1].max * 10000
                      }})*{{ items.scale }}%
                      <span v-if="indexs < item.depositConfigs.length - 1"
                        >+</span
                      ></span
                    >
                    <span v-else
                      >({{ items.max * 10000 }}-{{ items.min * 10000 }})*{{
                        items.scale
                      }}%
                      <span v-if="indexs < item.depositConfigs.length - 1"
                        >+</span
                      ></span
                    >
                  </span> </span
                >,最高限额{{ item.upperLimit }}元】
              </span>
              <span v-else>
                {{ item.shouldPay }}元({{ item.total }}*{{
                  item.depositConfig.scale
                }}%,最高限额{{ item.depositConfig.upperLimit }}元)</span
              >
            </el-radio>
            <el-radio
              v-else
              :label="item.shouldPay + '-' + item.depositConfigs[0].scale"
              :key="index + '1'"
              v-for="(item, index) in amountPayableList"
            >
              <span v-if="item.sectionType == 1"
                >{{ item.shouldPay }}元 【
                <span
                  v-for="(items, indexs) in item.depositConfigs"
                  :key="indexs"
                >
                  <span v-if="indexs == 0"
                    >{{ items.max * 10000 }}*{{ items.scale }}%
                    <span v-if="indexs < item.depositConfigs.length - 1"
                      >+</span
                    ></span
                  >
                  <span v-else>
                    <span v-if="item.total&lt;items.max*10000"
                      >({{ item.total }}-{{
                        item.depositConfigs[indexs - 1].max * 10000
                      }})*{{ items.scale }}%
                      <span v-if="indexs < item.depositConfigs.length - 1"
                        >+</span
                      ></span
                    >
                    <span v-else
                      >({{ items.max * 10000 }}-{{ items.min * 10000 }})*{{
                        items.scale
                      }}%
                      <span v-if="indexs < item.depositConfigs.length - 1"
                        >+</span
                      ></span
                    >
                  </span> </span
                >,最高限额{{ item.upperLimit }}元】
              </span>
              <span v-else>
                {{ item.shouldPay }}元({{ item.total }}*{{
                  item.depositConfigs[0].scale
                }}%,最高限额{{ item.depositConfigs[0].upperLimit }}元)</span
              >
            </el-radio>
          </el-radio-group>
        </el-form-item>
        <template
          v-if="
            formData.method === 'BANKGUARANTEE' ||
            formData.method === 'OWNERPOLICY' ||
            formData.method === 'BANKPOLICY'
          "
        >
          <el-form-item label="担保金额：" prop="payTotal">
            <el-input
              class="mWidth"
              v-model.trim="formData.payTotal"
              placeholder="请输入担保金额"
            ></el-input>
            <span class="unitMaLf">元</span>
          </el-form-item>
          <el-form-item label="担保机构：" prop="guaranteeName">
            <el-input
              class="mWidth"
              maxlength="200"
              v-model.trim="formData.guaranteeName"
              placeholder="请填写担保机构全称"
            ></el-input>
          </el-form-item>
          <el-form-item label="担保生效日：" prop="guaranteeStartDate">
            <el-date-picker
              class="mWidth"
              type="date"
              placeholder="请选择保函/担保生效的日期"
              v-model="formData.guaranteeStartDate"
              value-format="yyyy-MM-dd"
            ></el-date-picker>
          </el-form-item>
          <el-form-item label="担保到期日：" prop="guaranteeEndDate">
            <el-date-picker
              class="mWidth"
              type="date"
              placeholder="请选择保函/担保到期的日期"
              v-model="formData.guaranteeEndDate"
              value-format="yyyy-MM-dd"
            ></el-date-picker>
          </el-form-item>
        </template>
        <template
          v-else-if="
            formData.method === 'FUNDDEPOSIT' &&
            formData.payMethod === 'PART_PAY'
          "
        >
          <el-form-item label="减免金额：" prop="reduceMoney">
            <el-input
              style="position: relative; width: 193px"
              @blur.prevent="changeCount()"
              v-model.trim="formData.reduceMoney"
              placeholder="请输入减免金额"
            ></el-input>
            <span class="unitMaLf">元</span>
          </el-form-item>
          <el-form-item label="实缴金额：">
            <span class="shouldTotal greenWord">{{ calculatePayTotal }}元</span>
          </el-form-item>
        </template>
        <template
          v-else-if="
            formData.method === 'FUNDDEPOSIT' &&
            formData.payMethod === 'ALL_NO_PAY'
          "
        >
          <el-form-item label="免缴金额：">
            <span class="shouldTotal greenWord"
              >{{ formData.shouldPay }}元</span
            >
          </el-form-item>
        </template>
        <template
          v-else-if="
            formData.method === 'FUNDDEPOSIT' &&
            formData.payMethod === 'ALL_PAY'
          "
        >
          <el-form-item label="实缴金额：" prop="payTotal">
            <el-input
              style="position: relative; width: 193px"
              v-model.trim="formData.payTotal"
              placeholder="请输入实缴金额"
            ></el-input>
            <span class="unitMaLf greenWord">元</span>
          </el-form-item>
        </template>
        <el-form-item label="业务办理人：" prop="operator">
          <el-input
            class="mWidth"
            maxlength="10"
            v-model.trim="formData.operator"
            placeholder="请填写业务实际处理人员姓名"
          ></el-input>
        </el-form-item>
        <template
          v-if="
            formData.method === 'FUNDDEPOSIT' &&
            (formData.payMethod === 'PART_PAY' ||
              formData.payMethod === 'ALL_NO_PAY' ||
              formData.payMethod === 'WAIT_PAY')
          "
        >
          <el-form-item
            :label="
              formData.payMethod === 'PART_PAY'
                ? '减免原因：'
                : formData.payMethod === 'ALL_NO_PAY'
                ? '免缴原因：'
                : '缓缴原因：'
            "
            prop="reduceRemark"
          >
            <el-input
              type="textarea"
              :rows="3"
              class="mWidth"
              v-model.trim="formData.reduceRemark"
              autocomplete="off"
              :placeholder="
                formData.payMethod === 'PART_PAY'
                  ? '请填写保证金减免原因'
                  : formData.payMethod === 'ALL_NO_PAY'
                  ? '请填写保证金免缴原因'
                  : '请填写缓缴原因'
              "
              maxlength="200"
            ></el-input>
          </el-form-item>
          <el-form-item
            :label="
              formData.payMethod === 'PART_PAY'
                ? '减免凭证：'
                : formData.payMethod === 'ALL_NO_PAY'
                ? '免缴凭证：'
                : '缓缴凭证：'
            "
            prop="reducePayImg"
          >
            <div class="uploadBoxPay">
              <uploadAnnex
                class="mWidth"
                @getFileList="getFileList"
                :limitationFactor="limitationFactor"
                @getFile="getFile"
                :upLoadFile="upLoadFile"
              />
            </div>
          </el-form-item>
          <el-row v-model="formData.contractImgUrl">
            <uploadResult
              style="margin-left: 135px !important"
              :resultList="upLoadFile"
              @callBackResult="getFile"
            />
          </el-row>
        </template>
        <template v-else>
          <el-form-item label="缴纳原因：" prop="remark">
            <el-input
              type="textarea"
              :rows="3"
              class="mWidth"
              v-model.trim="formData.remark"
              autocomplete="off"
              placeholder="请填写缴纳备注信息"
              maxlength="200"
            ></el-input>
          </el-form-item>
        </template>
        <!--黄石地区 缴纳形式为【资金存入】，在缴纳凭证字段上方，需新增付款银行账户信息填写表单 -->
        <div v-if="isHsUser() && formData.method === 'FUNDDEPOSIT'">
          <el-form-item label="付款银行账户：" prop="">
            <p class="formItemTip mWidth">
              填写企业付款银行账号，不支持个人账户转账，后期保证金退还将原路退回
            </p>
          </el-form-item>
          <el-form-item label="开户银行：">
            <el-input
              v-model.trim="formData.institution"
              class="mWidth"
              autocomplete="off"
              placeholder="请输入付款账户开户银行，如工商银行等"
            ></el-input>
          </el-form-item>
          <el-form-item label="支行名称：">
            <el-input
              v-model.trim="formData.branch"
              class="mWidth"
              autocomplete="off"
              placeholder="请输入支行名称"
            ></el-input>
          </el-form-item>
          <el-form-item label="账户名称：">
            <el-input
              v-model.trim="formData.name"
              class="mWidth"
              autocomplete="off"
              placeholder="请输入账户名称"
            ></el-input>
          </el-form-item>
          <el-form-item label="银行卡号：">
            <el-input
              v-model.trim="formData.cardCode"
              class="mWidth"
              autocomplete="off"
              placeholder="请输入银行卡号"
            ></el-input>
          </el-form-item>
        </div>
        <!--黄石地区 缴纳形式为【银行保函】或【保险保单】 需新增填写寄件信息-->
        <div
          v-if="
            isHsUser() &&
            ['BANKGUARANTEE', 'BANKPOLICY'].includes(formData.method)
          "
        >
          <el-form-item label="寄件信息：" prop="">
            <p class="formItemTip mWidth">
              企业需要提前将保函或保单快递至劳动监察部门，查看
              <el-link @click="downLoadFile('sendFiles')">收件信息</el-link>
            </p>
            <p class="formItemTip">请在寄件后填写寄件人信息</p>
          </el-form-item>
          <el-form-item label="寄件人姓名：">
            <el-input
              v-model.trim="formData.institution"
              class="mWidth"
              autocomplete="off"
              placeholder="请输入寄件人姓名"
            ></el-input>
          </el-form-item>
          <el-form-item label="联系电话：">
            <el-input
              v-model.trim="formData.branch"
              class="mWidth"
              autocomplete="off"
              placeholder="请输入联系电话"
            ></el-input>
          </el-form-item>
          <el-form-item label="快递公司：">
            <el-input
              v-model.trim="formData.name"
              class="mWidth"
              autocomplete="off"
              placeholder="请输入快递公司名称"
            ></el-input>
          </el-form-item>
          <el-form-item label="快递单号：">
            <el-input
              v-model.trim="formData.cardCode"
              class="mWidth"
              autocomplete="off"
              placeholder="请输入快递单号"
            ></el-input>
          </el-form-item>
          <el-form-item label="寄件凭证：">
            <uploadAnnex
              class="mWidth"
              @getFileList="getExpressFileList"
              :limitationFactor="limitationExpress"
              @getFile="getExpressFile"
              :upLoadFile="expressFile"
            />
          </el-form-item>
          <el-row v-model="formData.senderFileJson">
            <uploadResult
              style="margin-left: 135px !important"
              :resultList="expressFile"
              @callBackResult="getExpressFile"
            />
          </el-row>
        </div>
        <!-- 非资金存入及资金存入全额缴纳/部分缴纳有缴纳凭证 -->
        <template
          v-if="
            formData.method !== 'FUNDDEPOSIT' ||
            (formData.method === 'FUNDDEPOSIT' &&
              (formData.payMethod === 'ALL_PAY' ||
                formData.payMethod === 'PART_PAY'))
          "
        >
          <el-form-item
            :label="
              isHsUser() &&
              ['BANKGUARANTEE', 'BANKPOLICY'].includes(formData.method)
                ? '保单保函：'
                : '缴纳凭证：'
            "
            prop="contractImgUrl"
          >
            <uploadAnnex
              class="mWidth"
              @getFileList="getFileListPay"
              :limitationFactor="limitationFactorPay"
              @getFile="getFilePay"
              :upLoadFile="uploadPayFile"
            />
          </el-form-item>
          <el-row v-model="formData.contractImgUrl">
            <uploadResult
              style="margin-left: 135px !important"
              :resultList="uploadPayFile"
              @callBackResult="getFilePay"
            />
          </el-row>
        </template>
        <el-form-item
          v-if="
            isHsUser() &&
            ['BANKGUARANTEE', 'BANKPOLICY'].includes(formData.method)
          "
          label=""
          label-width="20px"
        >
          <el-checkbox v-model="formData.checked"
            >勾选即代表同意
            <el-link @click="downLoadFile('constructionFiles')"
              >施工单位承诺书</el-link
            ></el-checkbox
          >
        </el-form-item>
      </el-form>

      <span slot="footer" class="dialog-footer">
        <el-button class="cancel" @click.native="closeFormDialog()"
          >取 消</el-button
        >
        <el-button
          type="primary"
          class="save"
          @click.native="toSubmitFormUptate()"
          :loading="isSaveLoading"
          >确 定</el-button
        >
      </span>
    </el-dialog>
  </div>
</template>
<script>
export default {
  data() {
    var checkMoneyB = (rule, value, callback) => {
      value = value.toString().replace(/\s+/g, '')
      if (value === '') {
        return callback(new Error('金额不能为空'))
      } else {
        var rePayTotal =
          /^(([1-9][0-9]*)|(([0]\.\d{1,2}|[1-9][0-9]*\.\d{1,2})))$/
        if (!rePayTotal.test(value) || value == 0.0 || value == 0.0) {
          callback(new Error('金额格式不正确,必须大于0,最多带有2位小数'))
        } else {
          if (value >= 100000000000) {
            callback(new Error('金额需小于1000亿'))
          } else {
            callback()
          }
        }
      }
    }
    var checkMoney = (rule, value, callback) => {
      if (!value) {
        if (
          this.formData.method === 'BANKGUARANTEE' ||
          this.formData.method === 'OWNERPOLICY' ||
          this.formData.method === 'BANKPOLICY'
        ) {
          return callback(new Error('担保金额不能为空'))
        } else if (
          this.formData.method === 'FUNDDEPOSIT' &&
          this.formData.payMethod === 'ALL_PAY'
        ) {
          return callback(new Error('实缴金额不能为空'))
        }
      } else {
        var rePayTotal =
          /^(([1-9][0-9]*)|(([0]\.\d{1,2}|[1-9][0-9]*\.\d{1,2})))$/
        if (!rePayTotal.test(value) || value == 0.0 || value == 0.0) {
          callback(new Error('金额格式不正确,必须大于0,最多带有2位小数'))
        } else {
          if (value >= 100000000000) {
            callback(new Error('金额需小于1000亿'))
          } else {
            callback()
          }
        }
      }
    }
    var checkShouldPay = (rule, value, callback) => {
      if (!this.formDataShouldPay) {
        return callback(new Error('应缴金额不能为空'))
      } else {
        callback()
      }
    }
    var checkMoneyReduce = (rule, value, callback) => {
      let shouldPay = this.formDataShouldPay.split('-')[0]
      if (!value && value != 0) {
        return callback(new Error('减免金额不能为空'))
      } else {
        var rePayTotal =
          /^(([1-9][0-9]*)|(([0]\.\d{1,2}|[1-9][0-9]*\.\d{1,2})))$/
        if (!rePayTotal.test(value) || value == 0.0 || value == 0.0) {
          callback(new Error('金额格式不正确,必须大于0,最多带有2位小数'))
        } else if (!shouldPay) {
          callback(new Error('请先选择应缴金额'))
        } else if (
          shouldPay &&
          (Number(value) > Number(shouldPay) ||
            Number(value) == Number(shouldPay))
        ) {
          callback(new Error('减免金额需小于应缴金额'))
        } else {
          callback()
        }
      }
    }
    var checkPayDate = (rule, value, callback) => {
      if (!value) {
        if (
          this.formData.method === 'FUNDDEPOSIT' &&
          this.formData.payMethod === 'WAIT_PAY'
        ) {
          return callback(new Error('缓缴日期不能为空'))
        } else {
          return callback(new Error('缴纳日期不能为空'))
        }
      } else {
        callback()
      }
    }
    var checkDate = (rule, value, callback) => {
      var guaranteeStartDate = this.formData.guaranteeStartDate
      var guaranteeEndDate = this.formData.guaranteeEndDate
      if (!guaranteeEndDate) {
        return callback(new Error('保函/担保到期的日期不能为空'))
      } else if (guaranteeStartDate > guaranteeEndDate) {
        return callback(new Error('担保到期日不能小于担保生效日'))
      } else {
        callback()
      }
    }

    var checkPayUploadFile = (rule, value, callback) => {
      if (this.uploadPayFile.length === 0) {
        if (
          this.isHsUser() &&
          ['BANKGUARANTEE', 'BANKPOLICY'].includes(this.formData.method)
        ) {
          return callback(new Error('保单保函不能为空'))
        } else {
          return callback(new Error('缴纳凭证不能为空'))
        }
      } else {
        callback()
      }
    }
    var checkExpressFile = (rule, value, callback) => {
      if (this.expressFile.length === 0) {
        return callback(new Error('寄件凭证不能为空'))
      } else {
        callback()
      }
    }
    var checkReason = (rule, value, callback) => {
      if (!value && this.formData.method === 'FUNDDEPOSIT') {
        if (this.formData.payMethod === 'PART_PAY') {
          return callback(new Error('减免原因不能为空'))
        } else if (this.formData.payMethod === 'ALL_NO_PAY') {
          return callback(new Error('免缴原因不能为空'))
        } else if (this.formData.payMethod === 'WAIT_PAY') {
          return callback(new Error('缓缴原因不能为空'))
        }
      } else {
        callback()
      }
    }
    var checkUploadFileReduce = (rule, value, callback) => {
      if (this.upLoadFile.length === 0) {
        if (this.formData.method === 'FUNDDEPOSIT') {
          if (this.formData.payMethod === 'PART_PAY') {
            return callback(new Error('减免凭证不能为空'))
          } else if (this.formData.payMethod === 'ALL_NO_PAY') {
            return callback(new Error('免缴凭证不能为空'))
          } else if (this.formData.payMethod === 'WAIT_PAY') {
            return callback(new Error('缓缴凭证不能为空'))
          }
        }
      } else {
        callback()
      }
    }
    return {
      //修改保证金缴纳记录
      payFormVisible: false,
      formData: {
        projectName: '',
        projectJson: '',
        projectId: '', //项目名称
        method: 'FUNDDEPOSIT', //缴纳方式
        payMethod: 'ALL_PAY', //缴纳形式
        reciveunit: '', //缴纳单位
        operationDate: '', //缴纳日期
        guaranteeStartDate: '', //担保生效日
        guaranteeEndDate: '', //担保到期日
        bankOne: '', //缴纳银行
        bankId: '', //缴纳银行
        bankName: '',
        account: '通过选择银行带入', //缴纳账号
        shouldPay: '', //应缴金额
        total: '', //工程造价
        scale: '', //工程造价比例
        upperLimit: '', //最高限额
        reduceMoney: '', //减免金额
        payTotal: '', //实缴金额
        guaranteeName: '', //担保机构
        operator: '', //业务办理人
        remark: '', //缴纳原因
        reduceRemark: '', //减免原因
        contractImgUrl: [], //合同附件

        institution: '',
        branch: '',
        name: '',
        cardCode: '',
        senderFileJson: [],
        checked: false,
        collectionUnit: '', //收缴单位
      },
      //验证
      formRules: {
        method: [
          {
            required: true,
            message: '请选择缴纳方式',
            trigger: ['blur', 'change'],
          },
        ],
        payMethod: [
          {
            required: true,
            message: '请选择缴纳形式',
            trigger: ['blur', 'change'],
          },
        ],
        reciveunit: [
          {
            required: true,
            message: '请选择缴纳单位',
            trigger: 'change',
          },
        ],
        operationDate: [
          {
            required: true,
            // message: "日期不能为空",
            validator: checkPayDate,
            trigger: 'change',
          },
        ],
        bankOne: [
          {
            required: true,
            message: '请选择缴纳银行',
            trigger: 'change',
          },
        ],
        operator: [
          {
            // pattern: /^[^\u4e00-\u9fa5]{0,}$/,
            pattern: /^[\u4e00-\u9fa5]+$/,
            message: '只能输入汉字',
            trigger: 'blur',
          },
        ],
        reduceMoney: [
          {
            required: true,
            validator: checkMoneyReduce,
            // message: "减免金额不能为空",
            trigger: 'blur',
          },
        ],
        payTotal: [
          {
            required: true,
            validator: checkMoney,
            trigger: 'blur',
          },
        ],
        shouldPay: [
          {
            required: true,
            validator: checkShouldPay,
            // message: "应缴金额不能为空",
            trigger: 'blur',
          },
        ],
        guaranteeName: [
          {
            required: true,
            message: '担保机构不能为空',
            trigger: 'blur',
          },
        ],
        guaranteeStartDate: [
          {
            required: true,
            message: '保函/担保生效的日期不能为空',
            trigger: 'change',
          },
        ],
        guaranteeEndDate: [
          {
            required: true,
            validator: checkDate,
            // message: "保函/担保到期的日期不能为空",
            trigger: 'change',
          },
        ],
        reduceRemark: [
          {
            required: true,
            // message: "原因不能为空",
            validator: checkReason,
            trigger: 'blur',
          },
        ],
        reducePayImg: [
          {
            required: true,
            validator: checkUploadFileReduce,
            trigger: 'change',
          },
        ],
        contractImgUrl: [
          {
            required: true,
            // message: "缴纳凭证不能为空",
            validator: checkPayUploadFile,
            trigger: 'change',
          },
        ],
        // collectionUnit: [
        //     {
        //         required: true,
        //         message: "收缴单位不能为空",
        //         trigger: "change"
        //     }
        // ]
      },
      formDataShouldPay: '',
      companyOptions: [],
      projectOptions: [],
      total: '',
      noBank: false,
      bankNameList: [],
      currentProjectAreaId: '', //当前项目区域id
      currentProjectTotal: '', //当前项目total
      cashDepositInfo: {},
      uploadPayFile: [],
      upLoadFile: [],
      limitationFactor: {
        uploadAnnexUrl: 'api-f/files/upload', //自定义上传文件接口地址
        upLoadFileLength: 10, //自定义上传附件的个数设置
        fileSize: 5, //自定义上传文件最大设置
        formatType: 'typeFour', //自定义上传格式校验类型
        fileId: 'salaryExcel', //自定义id解决一个页面包含多个上传附件
        uploadFormId: 'salaryExcelForm', //自定义id解决一个页面包含多个上传附件
        messagetip:
          '要求格式为png，jpg，jpeg，doc，docx，xls，xlsx，pdf格式，附件大小不超过5M', //自定义报错提示语
        methodTip: '', //自定义上传文件提示
        uploadBtnType: 'typeOne', //自定义上传按钮类型
      },
      limitationFactorPay: {
        uploadAnnexUrl: 'api-f/files/upload', //自定义上传文件接口地址
        upLoadFileLength: 10, //自定义上传附件的个数设置
        fileSize: 5, //自定义上传文件最大设置
        formatType: 'typeFour', //自定义上传格式校验类型
        fileId: 'salaryExcel1', //自定义id解决一个页面包含多个上传附件
        uploadFormId: 'salaryExcelForm1', //自定义id解决一个页面包含多个上传附件
        messagetip:
          '要求格式为png，jpg，jpeg，doc，docx，xls，xlsx，pdf格式，附件大小不超过5M', //自定义报错提示语
        methodTip: '', //自定义上传文件提示
        uploadBtnType: 'typeOne', //自定义上传按钮类型
      },

      //分段累加时使用
      bondSettingConfig: [],
      sectionType: 0,
      amountPayableList: [],
      checkExpressFile,
      expressFile: [],
      expressSrcList: [],
      oldExpressSrcList: [],
      limitationExpress: {
        uploadAnnexUrl: 'api-f/files/upload', //自定义上传文件接口地址
        upLoadFileLength: 10, //自定义上传附件的个数设置
        fileSize: 5, //自定义上传文件最大设置
        formatType: 'typeFour', //自定义上传格式校验类型
        fileId: 'salaryExcel2', //自定义id解决一个页面包含多个上传附件
        uploadFormId: 'salaryExcelForm2', //自定义id解决一个页面包含多个上传附件
        messagetip:
          '要求格式为png，jpg，jpeg，doc，docx，xls，xlsx，pdf格式，附件大小不超过5M', //自定义报错提示语
        methodTip:
          '请上寄件凭证，附件格式支持png，jpg，jpeg，doc，docx，xls，xlsx，pdf，最多上传10个附件', //自定义上传文件提示
        uploadBtnType: 'typeOne', //自定义上传按钮类型
      },

      rocordId: '',
      collectionUnitList: [],
      operationDate: [],
    }
  },
  props: ['shows', 'itemInfo'],
  watch: {
    shows(val) {
      this.payFormVisible = val

      if (val) {
        this.$nextTick(function () {
          this.$refs.formData.resetFields()
        })
        if (this.itemInfo.method !== 'FUNDDEPOSIT') {
          this.getProjectList()
          //  this.deitBond('402889347be7316c017be87164830001')
        } else {
          if (['ALL_PAY', 'PART_PAY'].includes(this.itemInfo.payMethod)) {
            this.getBondListId()
          } else {
            this.getProjectList()
          }

          //  this.deitBond('402889347be7316c017be87164830001')
        }
      }
    },
  },
  created() {
    // 昆明获取缴纳单位
    if (this.isKMUser()) {
      this.getCollectionUnit()
    }
  },
  methods: {
    agreeChange() {
      this.changeCount()
      this.formData.shouldPay = this.formDataShouldPay.split('-')[0]
    },
    //计算部分免缴中的实缴金额
    changeCount() {
      let shouldPay = this.formDataShouldPay.split('-')[0]
      if (this.formData.reduceMoney > 0 && shouldPay) {
        this.axios({
          method: 'post',
          url: 'api-d/deposit/expand/calculaccount',
          data: {
            shouldPay: shouldPay,
            exemptionAccount: this.formData.reduceMoney,
          },
        })
          .then((response) => {
            if (!response.data.hasError) {
              this.calculatePayTotal = response.data.result.payTotal
            } else {
              this.$message({
                type: 'error',
                message: response.data.errorMsg,
              })
            }
          })
          .catch((error) => {})
      } else {
        this.calculatePayTotal = ''
      }
    },
    closeFormDialog() {
      this.$emit('closeDialog')
    },
    getBondListId() {
      this.axios
        .post('api-d/accass/expand/findByProjectId', {
          projectId: this.itemInfo.projectId,
        })
        .then((res) => {
          if (!res.data.hasError) {
            this.rocordId = ''
            if (res.data.result.id) {
              this.rocordId = res.data.result.id
              this.deitBond(res.data.result.id)
            }
          }
        })
    },
    deitBond(id) {
      this.axios
        .post('api-d/accass/expand/accassdetail', { id })
        .then((res) => {
          if (!res.data.hasError) {
            const result = res.data.result
            this.formData.shouldPay = result.shouldPayTotal

            if (this.itemInfo.method == 'FUNDDEPOSIT') {
              this.uploadPayFile = result.file
            }
            this.getProjectList()
          }
        })
    },
    getProjectList() {
      // 打开弹框清空，避免一直添加数组
      this.companyOptions = []
      this.axios({
        method: 'post',
        url: 'api-p/projectstats/expand/list',
        data: {
          pageNo: 1,
          pageSize: 20,
          projectId: this.itemInfo.projectId,
          projectName: this.itemInfo.projectName,
          isSa: '',
        },
      })
        .then((response) => {
          if (!response.data.hasError) {
            this.projectOptions = response.data.result.results
            this.total = response.data.result.total
            this.$nextTick(() => {
              var currentObj = this.projectOptions[0]
              this.formData.projectJson = currentObj
              if (currentObj) {
                this.companyOptions.push(
                  {
                    companyName: currentObj.pcName,
                    companyType: '0', //建设方
                  },
                  {
                    companyName: currentObj.pbName,
                    companyType: '5', //施工方
                  }
                )
                this.getBankNameList(currentObj.areaId)
                this.currentProjectAreaId = currentObj.areaId
                this.currentProjectTotal = currentObj.total
                this.getCountShould(
                  currentObj.areaId,
                  currentObj.total,
                  this.itemInfo.method
                )
                // this.verifyIsExesit(currentObj.projectId);
                //缴纳修改初始化数据
                this.getCashDepositInfo()
              }
            })
          }
        })
        .catch((error) => {})
    },
    //获取保证金配置
    getBondSetting(areaId, total, depositType) {
      this.axios
        .post('api-d/deposit/expand/countshould', {
          areaId,
          total,
          depositType,
        })
        .then((res) => {
          this.bondSettingConfig = res.data.result
          this.sectionType = this.bondSettingConfig[0].sectionType
        })
    },
    getCashDepositInfo() {
      this.axios({
        method: 'post',
        url: 'api-d/deposit/expand/detail',
        data: {
          id: this.itemInfo.id,
        },
      })
        .then((response) => {
          var data = response.data.result
          this.getBondSetting(data.areaId, data.projectTotal, data.method)

          this.formDataShouldPay = data.shouldPayTotalReal + '-' + data.payScale
          this.formData.projectName = data.projectName
          this.formData.companyName = data.companyName
          this.formData.reciveunit = data.companyType
          this.formData.operationDate = data.operationDate
          if (data.payMethod == 'WAIT_PAY') {
            let obj = data.waitPayCycle.split('至')
            this.operationDate = [obj[0], obj[1]]
          }
          this.formData.method = data.method
          this.formData.payMethod = data.payMethod
          this.formData.bankOne =
            data.bankId + ',' + data.account + ',' + data.bankName
          //相当于点击按钮赋值
          this.changeBankName(this.formData.bankOne)
          this.formData.account = data.account
          this.formData.reduceMoney = data.exemptionAccount
          this.formData.shouldPayTotal = data.shouldPayTotal || '0'
          this.formData.projectTotal = data.projectTotal || '0'
          this.calculatePayTotal = data.payTotalReal || '0'
          this.formData.payTotal = data.payTotalReal || '0'
          // this.formData.upperLimit = data.upperLimit || "0";
          this.formData.payScale = data.payScale || '0'
          this.formData.guaranteeName = data.guaranteeName
          this.formData.guaranteeStartDate = data.guaranteeStartDate
          this.formData.guaranteeEndDate = data.guaranteeEndDate
          this.formData.operator = data.operator
          this.formData.remark = data.remark
          this.formData.reduceRemark = data.remark
          //昆明 - 收缴单位
          this.formData.collectionUnit = data.collectionUnit
          //状态标志图片

          if (data.method !== 'FUNDDEPOSIT') {
            delete this.formRules.payMethod
            this.uploadPayFile = data.file
          } else {
            if (
              ['ALL_NO_PAY', 'PART_PAY', 'WAIT_PAY'].includes(data.payMethod)
            ) {
              this.upLoadFile = data.file
            }
          }

          this.showFileText()
          this.$nextTick(() => {
            // 黄石地区
            if (this.isHsUser()) {
              if (data.method !== 'FUNDDEPOSIT') {
                this.$set(this.formData, 'institution', data.institution)
                this.$set(this.formData, 'branch', data.branch)
                this.$set(this.formData, 'name', data.name)
                this.$set(this.formData, 'cardCode', data.cardCode)
                this.$set(this.formData, 'senderFileJson', data.senderFile)
                this.expressFile = data.senderFile
                this.$set(
                  this.formData,
                  'checked',
                  data.isConfirm ? true : false
                )
                this.$set(this.formRules, 'senderFileJson', [
                  {
                    required: true,
                    validator: this.checkExpressFile,
                    trigger: 'change',
                  },
                ])
                this.$set(this.formRules, 'institution', [
                  {
                    required: true,
                    message: '请输入寄件人姓名',
                    trigger: 'blur',
                  },
                  {
                    required: true,
                    min: 1,
                    max: 20,
                    message: '支持输入1-20个字符',
                    trigger: 'blur',
                  },
                ])
                this.$set(this.formRules, 'branch', [
                  {
                    required: true,
                    message: '请输入寄件人电话',
                    trigger: 'blur',
                  },
                  {
                    required: true,
                    pattern: /^[\d\-\(\)\ ]{7,11}$/,
                    message: '只能输入7-11位数字',
                    trigger: 'blur',
                  },
                ])
                this.$set(this.formRules, 'name', [
                  {
                    required: true,
                    message: '请输入快递公司',
                    trigger: 'blur',
                  },
                  {
                    required: true,
                    min: 1,
                    max: 10,
                    message: '支持输入1-10个字符',
                    trigger: 'blur',
                  },
                ])
                this.$set(this.formRules, 'cardCode', [
                  {
                    required: true,
                    message: '请输入快递单号',
                    trigger: 'blur',
                  },
                  {
                    required: true,
                    min: 1,
                    max: 30,
                    message: '支持输入1-30个字符',
                    trigger: 'blur',
                  },
                ])
              } else if (data.method == 'FUNDDEPOSIT') {
                this.expressFile = []
                this.$set(this.formData, 'institution', data.institution)
                this.$set(this.formData, 'branch', data.branch)
                this.$set(this.formData, 'name', data.name)
                this.$set(this.formData, 'cardCode', data.cardCode)
                this.$set(this.formRules, 'institution', [
                  {
                    required: true,
                    message: '请输入开户银行',
                    trigger: 'blur',
                  },
                  {
                    required: true,
                    min: 1,
                    max: 10,
                    message: '支持输入1-10个字符',
                    trigger: 'blur',
                  },
                ])
                this.$set(this.formRules, 'branch', [
                  {
                    required: true,
                    message: '请输入支行名称',
                    trigger: 'blur',
                  },
                  {
                    required: true,
                    min: 1,
                    max: 30,
                    message: '支持输入1-30个字符',
                    trigger: 'blur',
                  },
                ])
                this.$set(this.formRules, 'name', [
                  {
                    required: true,
                    message: '请输入账户名称',
                    trigger: 'blur',
                  },
                  {
                    required: true,
                    min: 1,
                    max: 30,
                    message: '支持输入1-30个字符',
                    trigger: 'blur',
                  },
                ])
                this.$set(this.formRules, 'cardCode', [
                  {
                    required: true,
                    message: '请输入银行卡号',
                    trigger: 'blur',
                  },
                  {
                    required: true,
                    pattern: /^[\d\-\(\)\ ]{7,30}$/,
                    message: '只能输入7-30位数字',
                    trigger: 'blur',
                  },
                ])
              }
            }
          })
        })
        .catch((error) => {})
    },
    changeBankName(val) {
      // 获取选中的银行卡号
      var bankOne = val.split(',')
      this.formData.bankId = bankOne[0]
      this.formData.account = bankOne[1]
      this.formData.bankName = bankOne[2]
    },
    getCountShould(areaId, total, depositType) {
      this.axios({
        method: 'post',
        url: 'api-d/deposit/expand/countshould',
        data: {
          areaId: areaId,
          total: total,
          depositType: depositType,
        },
      })
        .then((response) => {
          var data = response.data
          if (!data.hasError) {
            var result = response.data.result
            this.amountPayableList = response.data.result
            this.sectionType = result.sectionType
            // this.formData.shouldPay = result.shouldPay || "0";
            // this.formData.total = result.total || "0";
            // this.formData.scale = result.depositConfig.scale || "0";
            // this.formData.upperLimit =
            //     result.depositConfig.upperLimit || "0";
          }
        })
        .catch((error) => {})
    },
    getBankNameList(areaId) {
      this.axios({
        method: 'post',
        url: 'api-d/account/expand/finddprobank',
        data: {
          areaId: areaId,
        },
      })
        .then((response) => {
          if (!response.data.hasError) {
            var data = response.data.result
            if (data.length > 0) {
              this.noBank = false
              this.bankNameList = data
            } else {
              this.noBank = true
            }
          }
        })
        .catch((error) => {})
    },
    payTypeChange(val) {
      return false
      this.showFileText()
      // 黄石地区
      if (this.isHsUser()) {
        this.expressFile = []
        this.uploadPayFile = []
        this.$set(this.formData, 'institution', '')
        this.$set(this.formData, 'branch', '')
        this.$set(this.formData, 'name', '')
        this.$set(this.formData, 'cardCode', '')
        if (val === 'FUNDDEPOSIT') {
          delete this.formData.senderFileJson
          delete this.formRules.senderFileJson
          delete this.formRules.checked

          this.$set(this.formRules, 'institution', [
            { required: true, message: '请输入开户银行', trigger: 'blur' },
            {
              required: true,
              min: 1,
              max: 10,
              message: '支持输入1-10个字符',
              trigger: 'blur',
            },
          ])
          this.$set(this.formRules, 'branch', [
            { required: true, message: '请输入支行名称', trigger: 'blur' },
            {
              required: true,
              min: 1,
              max: 30,
              message: '支持输入1-30个字符',
              trigger: 'blur',
            },
          ])
          this.$set(this.formRules, 'name', [
            { required: true, message: '请输入账户名称', trigger: 'blur' },
            {
              required: true,
              min: 1,
              max: 30,
              message: '支持输入1-30个字符',
              trigger: 'blur',
            },
          ])
          this.$set(this.formRules, 'cardCode', [
            { required: true, message: '请输入银行卡号', trigger: 'blur' },
            {
              required: true,
              pattern: /^[\d\-\(\)\ ]{7,30}$/,
              message: '只能输入7-30位数字',
              trigger: 'blur',
            },
          ])
        } else if (['BANKGUARANTEE', 'BANKPOLICY'].includes(val)) {
          this.$set(this.formRules, 'institution', [
            { required: true, message: '请输入寄件人姓名', trigger: 'blur' },
            {
              required: true,
              min: 1,
              max: 20,
              message: '支持输入1-20个字符',
              trigger: 'blur',
            },
          ])
          this.$set(this.formRules, 'branch', [
            { required: true, message: '请输入寄件人电话', trigger: 'blur' },
            {
              required: true,
              pattern: /^[\d\-\(\)\ ]{7,11}$/,
              message: '只能输入7-11位数字',
              trigger: 'blur',
            },
          ])
          this.$set(this.formRules, 'name', [
            { required: true, message: '请输入快递公司', trigger: 'blur' },
            {
              required: true,
              min: 1,
              max: 10,
              message: '支持输入1-10个字符',
              trigger: 'blur',
            },
          ])
          this.$set(this.formRules, 'cardCode', [
            { required: true, message: '请输入快递单号', trigger: 'blur' },
            {
              required: true,
              min: 1,
              max: 30,
              message: '支持输入1-30个字符',
              trigger: 'blur',
            },
          ])
          this.$set(this.formData, 'senderFileJson', [])
          this.$set(this.formData, 'checked', false)
          this.$set(this.formRules, 'senderFileJson', [
            {
              required: true,
              validator: this.checkExpressFile,
              trigger: 'change',
            },
          ])
        }
      }
      //切换缴纳方式应缴金额变化
      this.getCountShould(
        this.currentProjectAreaId,
        this.currentProjectTotal,
        this.formData.method
      )
      this.showForm = false
      // 重置验证不重置表单内容
      this.$nextTick(() => {
        this.showForm = true
        // this.$refs.formData.clearValidate();
      })
    },
    getFile(val) {
      this.upLoadFile = val
    },
    getFileListPay(val) {
      // this.paySrcList.push(val);
      // this.oldPaySrcList.push(val);
    },
    getFileList(val) {},
    getFilePay(val) {
      this.uploadPayFile = val
    },
    showFileText() {
      if (this.formData.method == 'FUNDDEPOSIT') {
        this.limitationFactorPay.methodTip =
          '请上传缴款回执单，附件格式支持png，jpg，jpeg，doc，docx，xls，xlsx，pdf，最多上传10个附件'
      } else if (this.formData.method == 'BANKGUARANTEE') {
        this.limitationFactorPay.methodTip =
          '请上传银行保函单，附件格式支持png，jpg，jpeg，doc，docx，xls，xlsx，pdf，最多上传10个附件'
      } else if (this.formData.method == 'OWNERPOLICY') {
        this.limitationFactorPay.methodTip =
          '请上传业主担保单，附件格式支持png，jpg，jpeg，doc，docx，xls，xlsx，pdf，最多上传10个附件'
      } else {
        this.limitationFactorPay.methodTip =
          '请上传保险保单，附件格式支持png，jpg，jpeg，doc，docx，xls，xlsx，pdf，最多上传10个附件'
      }
      if (this.formData.payMethod == 'PART_PAY') {
        this.limitationFactor.methodTip =
          '请上传减免凭证，附件格式支持png，jpg，jpeg，doc，docx，xls，xlsx，pdf，最多上传10个附件'
      } else if (this.formData.payMethod == 'ALL_NO_PAY') {
        this.limitationFactor.methodTip =
          '请上传免缴凭证，附件格式支持png，jpg，jpeg，doc，docx，xls，xlsx，pdf，最多上传10个附件'
      } else if (this.formData.payMethod == 'WAIT_PAY') {
        this.limitationFactor.methodTip =
          '请上传缓缴凭证，附件格式支持png，jpg，jpeg，doc，docx，xls，xlsx，pdf，最多上传10个附件'
      }
    },
    toSubmitFormUptate() {
      this.$refs.formData.validate((valid) => {
        if (this.isHsUser()) {
          if (
            ['BANKGUARANTEE', 'BANKPOLICY'].includes(this.formData.method) &&
            !this.formData.checked
          ) {
            this.$message({
              type: 'warning',
              message: '请先同意施工单位承诺书',
            })
            return false
          }
        }
        if (valid) {
          this.isSaveLoading = true
          this.submitFormUptate()
        } else {
          return false
        }
      })
    },
    submitFormUptate() {
      //资金存入
      var fundDeposit = this.formData.method === 'FUNDDEPOSIT'
      var allPay = this.formData.payMethod === 'ALL_PAY'
      var partPay = this.formData.payMethod === 'PART_PAY'
      var allNoPay = this.formData.payMethod === 'ALL_NO_PAY'
      var waitPay = this.formData.payMethod === 'WAIT_PAY'
      var fileJson, exemptionAccount, payTotal
      if (fundDeposit && (partPay || allNoPay || waitPay)) {
        fileJson = JSON.stringify(this.upLoadFile)
      } else {
        fileJson = JSON.stringify(this.uploadPayFile)
      }
      // 减免金额和全额免缴 都传 exemptionAccount
      if (fundDeposit && partPay) {
        exemptionAccount = this.formData.reduceMoney
      } else if (fundDeposit && allNoPay) {
        exemptionAccount = this.formData.shouldPay
      } else {
        exemptionAccount = ''
      }
      //1.全额免缴和缓缴没有实缴金额   2.部分免缴中 实缴由计算得出
      if (fundDeposit && allNoPay) {
        payTotal = ''
      } else if (fundDeposit && partPay) {
        payTotal = this.calculatePayTotal
      } else {
        payTotal = this.formData.payTotal
      }
      var data = {
        id: this.itemInfo.id, //保证金id
        projectJson: JSON.stringify(this.formData.projectJson),
        companyType: this.formData.reciveunit,
        method: this.formData.method,
        // 资金存入-缴纳形式
        payMethod: fundDeposit ? this.formData.payMethod : '',
        operationDateString: this.formData.operationDate,
        // 资金存入-（全额缴纳/部分免缴）存在缴纳银行和缴纳账号信息
        bankId:
          fundDeposit && (allPay || partPay || waitPay)
            ? this.formData.bankId === 'null'
              ? null
              : this.formData.bankId
            : '',
        bankName:
          fundDeposit && (allPay || partPay || waitPay)
            ? this.formData.bankName === 'null'
              ? null
              : this.formData.bankName
            : '',
        account:
          fundDeposit && (allPay || partPay || waitPay)
            ? this.formData.account === 'null'
              ? null
              : this.formData.account
            : '',
        // shouldPayTotal: this.formData.shouldPay,
        // payScale: this.formData.scale, //后台新增字段
        shouldPayTotal: this.formDataShouldPay.split('-')[0],
        payScale: this.formDataShouldPay.split('-')[1], //后台新增字段
        // 全额免缴和缓缴没有实缴金额
        payTotal: payTotal, //实缴金额
        exemptionAccount: exemptionAccount,
        //非资金存入 担保机构，担保生效日，担保失效日
        guaranteeName: fundDeposit ? '' : this.formData.guaranteeName,
        guaranteeStartDateString: fundDeposit
          ? ''
          : this.formData.guaranteeStartDate,
        guaranteeEndDateString: fundDeposit
          ? ''
          : this.formData.guaranteeEndDate,
        operator: this.formData.operator,
        //部分免缴，全额免缴，缓缴 原因为必填项
        remark:
          fundDeposit && (partPay || allNoPay || waitPay)
            ? this.formData.reduceRemark
            : this.formData.remark,
        // 部分免缴的    缴纳凭证用noAllPayFileJson  其他凭证名字都用fileJson
        //减免凭证，缓缴凭证，缓缴凭证
        noAllPayFileJson:
          (fundDeposit && partPay) || allNoPay || waitPay
            ? JSON.stringify(this.upLoadFile)
            : [],
        //缴纳凭证
        // 非资金存入及资金存入全额缴纳/部分缴纳有缴纳凭证
        fileJson: fileJson,
        //昆明 - 收缴单位
        collectionUnit: this.formData.collectionUnit,
      }

      if (
        this.itemInfo.method == 'FUNDDEPOSIT' &&
        ['ALL_PAY', 'PART_PAY'].includes(this.itemInfo.payMethod)
      ) {
        data.accassId = this.rocordId
      }
      if (waitPay) {
        data.waitPayCycle = this.operationDate[0] + '至' + this.operationDate[1]
      }
      // 黄石地区 添加另外的4个参数
      if (this.isHsUser()) {
        data.institution = this.formData.institution
        data.branch = this.formData.branch
        data.name = this.formData.name
        data.cardCode = this.formData.cardCode

        if (['BANKGUARANTEE', 'BANKPOLICY'].includes(this.formData.method)) {
          data.senderFileJson = JSON.stringify(this.expressFile)
          data.isConfirm = this.formData.checked ? 1 : 0
        }
      }
      this.axios({
        method: 'post',
        url: 'api-d/deposit/expand/eidtdeposit',
        data: data,
      })
        .then((response) => {
          this.isSaveLoading = false
          if (!response.data.hasError) {
            this.$message({
              message: '修改成功',
              type: 'success',
            })

            this.$emit('successDialog')
          } else {
            this.$message({
              type: 'error',
              message: response.data.errorMsg,
            })
          }
        })
        .catch((error) => {})
    },
    downLoadFile(type) {
      this.axios({
        method: 'post',
        url: 'api-p/deposit/expand/findurl',
        data: {
          type: type,
        },
      })
        .then(
          (response) => {
            if (!response.data.hasError) {
              window.open(response.data.result.url)
            } else {
              this.$message({
                type: 'error',
                message: response.data.msg,
              })
            }
          },
          (response) => {}
        )
        .catch((error) => {})
    },
    getCollectionUnit() {
      this.axios({
        method: 'post',
        url: 'api-bs/base/dicitem/getCollectionUnit',
        data: {
          type: 'DEPOSIT_COLLECTION_UNIT',
        },
      })
        .then((response) => {
          if (!response.data.hasError) {
            this.collectionUnitList = response.data.result
          } else {
            this.$message({
              type: 'error',
              message: response.data.errorMsg,
            })
          }
        })
        .catch((error) => {})
    },
  },
}
</script>
<style lang="less" scoped>
.el-radio {
  line-height: 35px;
}
.formItemTip {
  line-height: 20px;
  padding: 8px 0;
}
</style>
